/*LICENSE_BEGIN
 * ******************************************************************
 * Copyright 2006 by the Dainamite Robocup-Team at the
 * DAI-Labor, TU-Berlin (www.dai-labor.de)
 * 
 * Members of Dainamite are:
 * Holger Endert
 * Robert Wetzker
 * Thomas Karbe
 * Axel Heßler
 * Philippe Bütter
 * Felix Brossmann
 * 
 * Licensed under the GNU GPL (General Public License) Free Software 
 * License, Version 2. You may use this file only in compliance with 
 * the License. You may obtain a copy of the License at:
 * 
 * http://www.fsf.org/licensing/licenses/gpl.txt
 * ******************************************************************
LICENSE_END*/
package robocup.component.actions;

/**
 * A dash action, which has the effect of accelerating the player.
 */
public class DashAction extends Action {
	
	/**
	 * The power, by which a player should be accelerated. Feasible values range
	 * from SConf.MINPOWER to SConf.MAXPOWER, which usually are [-100,100].
	 * Negative values indicate backward dashing.
	 */
	private int _power;

	/**
	 * Returns the actions string representation:
	 * @return (dash &lt;power&gt;)
	 */
	@Override
	public String toString() {
		StringBuffer buf = new StringBuffer();
		buf.append("(dash ");
		buf.append(this._power);
		buf.append(")");
		return buf.toString();
	}

	/**
	 * Constructor of DashAction
	 * 
	 * @param power
	 *            A value of [-100,100]
	 */
	public DashAction(int power) {
		this._power = power;
		this._type = TYPE.DASH;
	}

	/**
	 * An action is worth sending if it effects the world.
	 */
	@Override
	public boolean isWorthSending() {
		return !(this._power == 0);
	}

	/**
	 * @return Returns the power.
	 */
	public int getPower() {
		return this._power;
	}

	/**
	 * @param _power
	 *            The _power to set.
	 */
	public void setPower(int _power) {
		this._power = _power;
	}
}
